﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace GISCommon.UI
{
    public partial class findCom : Component
    {
        public findCom()
        {
            InitializeComponent();

            if (m_pMapControl != null)
                frmFind = new FindForm(m_pMapControl);
            else
                frmFind = new FindForm();
        }

        public findCom(IContainer container)
        {
            container.Add(this);

            InitializeComponent();

            if (m_pMapControl != null)
                frmFind = new FindForm(m_pMapControl);
            else
                frmFind = new FindForm();
        }

        private ESRI.ArcGIS.Controls.AxMapControl m_pMapControl = null;
        public ESRI.ArcGIS.Controls.AxMapControl MapControl
        {
            get { return m_pMapControl; }
            set { m_pMapControl = value; }
        }

        private FindForm frmFind = null;

        public void Show()
        {
            if (frmFind != null)
            {
                if (m_pMapControl != null)
                    frmFind.MapControl = m_pMapControl;
                else
                {
                    System.Windows.Forms.MessageBox.Show("未设置MapControl属性");
                    return;
                }
                frmFind.CancelFinding = false;
                frmFind.Show();
            }
        }
    }
}
